from django.db import models


class TdsdDataSource(models.Model):
    source_name = models.CharField(max_length=60)  # 同一个用户名下数据源名称不能重复，在视图中处理
    host_ip = models.CharField(max_length=60)
    db_ip = models.CharField(max_length=60)
    port = models.CharField(max_length=6)
    sid = models.CharField(max_length=60)
    username = models.CharField(max_length=255)
    password = models.CharField(max_length=60)
    schema = models.CharField(max_length=60, null=True)
    desc = models.CharField(max_length=60, null=True)
    conn_url = models.CharField(max_length=255, null=True)
    jdbc_url = models.CharField(max_length=255, null=True)
    isdelete = models.BooleanField(default=0)
    create_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)
    user_id = models.IntegerField()
    db_cate = models.CharField(max_length=20, null=True)

    class Meta:
        db_table = 'tdsd_data_source'


class TdsdFtpSource(models.Model):
    ftp_id = models.AutoField(primary_key=True)
    ftp_name = models.CharField(max_length=60)
    ftp_ip = models.CharField(max_length=60)
    ftp_port = models.CharField(max_length=6)
    ftp_username = models.CharField(max_length=60)
    ftp_password = models.CharField(max_length=60)
    ftp_schema = models.SmallIntegerField()
    isdelete = models.BooleanField(default=0)
    create_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)
    user_id = models.IntegerField()

    class Meta:
        db_table = 'tdsd_ftp_source'
